/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JFramePrincipal.java
 *
 * Created on Apr 10, 2012, 9:59:33 PM
 */
package herancapessoa.gui;

import herancapessoa.controles.PessoaFisicaManager;
import herancapessoa.controles.PessoaJuridicaManager;
import herancapessoa.controles.PessoaManager;
import herancapessoa.negocio.Cidade;
import herancapessoa.negocio.Endereco;
import herancapessoa.negocio.Pessoa;
import herancapessoa.negocio.PessoaFisica;
import herancapessoa.negocio.PessoaJuridica;
import herancapessoa.persistencia.CidadeDAO;
import herancapessoa.persistencia.EnderecoDAO;
import herancapessoa.persistencia.PessoaFisicaDAO;
import herancapessoa.persistencia.PessoaJuridicaDAO;
import herancapessoa.utils.HibernateUtil;
import java.awt.CardLayout;
import java.util.List;
import javax.swing.ButtonGroup;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import org.hibernate.Hibernate;
import org.hibernate.Session;

/**
 *
 * @author Ricky
 */
public class JFramePrincipal extends javax.swing.JFrame {

    /** Creates new form JFramePrincipal */
    public JFramePrincipal() {
        
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {}
        initComponents();
        setLocationRelativeTo(null);
        setTitle("Trabalho Herança");
        ButtonGroup bg = new ButtonGroup();
        bg.add(jRadioButtonJuridica);
        bg.add(jRadioButtonFisica);

        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanelInfoGeral = new javax.swing.JPanel();
        jLabelInfoNome = new javax.swing.JLabel();
        jLabelInfoTel = new javax.swing.JLabel();
        jLabelInfoEmail = new javax.swing.JLabel();
        jLabelInfoMaxValue = new javax.swing.JLabel();
        jLabelInfoValue = new javax.swing.JLabel();
        jLabelInfo1 = new javax.swing.JLabel();
        jLabelInfo2 = new javax.swing.JLabel();
        jLabelInfo3 = new javax.swing.JLabel();
        jLabelInfo4 = new javax.swing.JLabel();
        jLabelInfo5 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jPanelConsultas = new javax.swing.JPanel();
        jTextFieldSearch = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextAreaInfo = new javax.swing.JTextArea();
        jScrollPane1 = new javax.swing.JScrollPane();
        jListConsulta = new javax.swing.JList();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextAreaEnd = new javax.swing.JTextArea();
        jButtonOp = new javax.swing.JButton();
        jPanelCadastrosNome = new javax.swing.JPanel();
        jRadioButtonJuridica = new javax.swing.JRadioButton();
        jRadioButtonFisica = new javax.swing.JRadioButton();
        jLabelCadastroNome = new javax.swing.JLabel();
        jLabelCadastroTel = new javax.swing.JLabel();
        jLabelCadastroEmail = new javax.swing.JLabel();
        jLabelCadastroLimite = new javax.swing.JLabel();
        jTextFieldCadastroNome = new javax.swing.JTextField();
        jTextFieldCadastroEmail = new javax.swing.JTextField();
        jTextFieldCadastroTel = new javax.swing.JTextField();
        jTextFieldCadastroLimite = new javax.swing.JTextField();
        jLabelCadastro1 = new javax.swing.JLabel();
        jLabelCadastro2 = new javax.swing.JLabel();
        jLabelCadastro3 = new javax.swing.JLabel();
        jLabelCadastro4 = new javax.swing.JLabel();
        jTextFieldCadastro4 = new javax.swing.JTextField();
        jTextFieldCadastro3 = new javax.swing.JTextField();
        jTextFieldCadastro2 = new javax.swing.JTextField();
        jTextFieldCadastro1 = new javax.swing.JTextField();
        jLabelEndUF = new javax.swing.JLabel();
        jLabelEndCidade = new javax.swing.JLabel();
        jLabelEndBairro = new javax.swing.JLabel();
        jLabelEndRua = new javax.swing.JLabel();
        jLabelEndNum = new javax.swing.JLabel();
        jLabelEndCEP = new javax.swing.JLabel();
        jTextFieldEndUF = new javax.swing.JTextField();
        jTextFieldEndCidade = new javax.swing.JTextField();
        jTextFieldEndBairro = new javax.swing.JTextField();
        jTextFieldEndRua = new javax.swing.JTextField();
        jTextFieldEndNum = new javax.swing.JTextField();
        jTextFieldEndCEP = new javax.swing.JTextField();
        jButtonConfirmar = new javax.swing.JButton();
        jButtonLimpar = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenuArquivo = new javax.swing.JMenu();
        jMenuItemCadastros = new javax.swing.JMenuItem();
        jMenuItemConsultas = new javax.swing.JMenuItem();
        jMenuItemArquivoSair = new javax.swing.JMenuItem();

        jLabelInfoNome.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfoNome.setText("Nome:");

        jLabelInfoTel.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfoTel.setText("Tel:");

        jLabelInfoEmail.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfoEmail.setText("Email:");

        jLabelInfoMaxValue.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfoMaxValue.setText("Limite:");

        jLabelInfoValue.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfoValue.setText("Saldo:");

        jLabelInfo1.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfo1.setText(" ");

        jLabelInfo2.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfo2.setText(" ");

        jLabelInfo3.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfo3.setText(" ");

        jLabelInfo4.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfo4.setText(" ");

        jLabelInfo5.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelInfo5.setText(" ");

        javax.swing.GroupLayout jPanelInfoGeralLayout = new javax.swing.GroupLayout(jPanelInfoGeral);
        jPanelInfoGeral.setLayout(jPanelInfoGeralLayout);
        jPanelInfoGeralLayout.setHorizontalGroup(
            jPanelInfoGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelInfoGeralLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelInfoGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelInfoNome)
                    .addComponent(jLabelInfoTel)
                    .addComponent(jLabelInfoEmail)
                    .addComponent(jLabelInfoMaxValue)
                    .addComponent(jLabelInfoValue)
                    .addComponent(jLabelInfo2)
                    .addComponent(jLabelInfo3)
                    .addComponent(jLabelInfo4)
                    .addComponent(jLabelInfo5)
                    .addGroup(jPanelInfoGeralLayout.createSequentialGroup()
                        .addComponent(jLabelInfo1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(123, Short.MAX_VALUE))
        );
        jPanelInfoGeralLayout.setVerticalGroup(
            jPanelInfoGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelInfoGeralLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelInfoNome)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInfoTel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInfoEmail)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInfoMaxValue)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInfoValue)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInfo1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInfo2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInfo3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInfo4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInfo5)
                .addContainerGap(53, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jPanel1.setLayout(new java.awt.CardLayout());

        jTextFieldSearch.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jTextFieldSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldSearchActionPerformed(evt);
            }
        });
        jTextFieldSearch.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextFieldSearchKeyTyped(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabel4.setText("Buscar:");

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Informações"));
        jPanel3.setMaximumSize(new java.awt.Dimension(392, 344));
        jPanel3.setMinimumSize(new java.awt.Dimension(392, 344));

        jScrollPane3.setHorizontalScrollBar(null);

        jTextAreaInfo.setBackground(java.awt.SystemColor.control);
        jTextAreaInfo.setColumns(20);
        jTextAreaInfo.setRows(5);
        jScrollPane3.setViewportView(jTextAreaInfo);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 385, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 169, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE))
        );

        jListConsulta.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
        jListConsulta.setModel(listModel);
        jListConsulta.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jListConsultaValueChanged(evt);
            }
        });
        jScrollPane1.setViewportView(jListConsulta);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true), "Endereço"));

        jTextAreaEnd.setBackground(java.awt.SystemColor.control);
        jTextAreaEnd.setColumns(20);
        jTextAreaEnd.setRows(5);
        jScrollPane2.setViewportView(jTextAreaEnd);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
        );

        jButtonOp.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jButtonOp.setText("Operação");
        jButtonOp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonOpActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelConsultasLayout = new javax.swing.GroupLayout(jPanelConsultas);
        jPanelConsultas.setLayout(jPanelConsultasLayout);
        jPanelConsultasLayout.setHorizontalGroup(
            jPanelConsultasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelConsultasLayout.createSequentialGroup()
                .addGroup(jPanelConsultasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
                    .addGroup(jPanelConsultasLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldSearch, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelConsultasLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jButtonOp, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelConsultasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanelConsultasLayout.setVerticalGroup(
            jPanelConsultasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelConsultasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelConsultasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelConsultasLayout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanelConsultasLayout.createSequentialGroup()
                        .addGroup(jPanelConsultasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(jTextFieldSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonOp)))
                .addContainerGap())
        );

        jPanel1.add(jPanelConsultas, "cardConsultas");
        PessoaManager.startSearchEngine();

        jRadioButtonJuridica.setFont(new java.awt.Font("Arial", 0, 12));
        jRadioButtonJuridica.setText("Juridica");
        jRadioButtonJuridica.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonJuridicaActionPerformed(evt);
            }
        });

        jRadioButtonFisica.setFont(new java.awt.Font("Arial", 0, 12));
        jRadioButtonFisica.setText("Fisica");
        jRadioButtonFisica.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonFisicaActionPerformed(evt);
            }
        });

        jLabelCadastroNome.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelCadastroNome.setText("Nome: ");

        jLabelCadastroTel.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelCadastroTel.setText("Tel: ");

        jLabelCadastroEmail.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelCadastroEmail.setText("Email:");

        jLabelCadastroLimite.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelCadastroLimite.setText("Limite:");

        jTextFieldCadastroNome.setFont(new java.awt.Font("Arial", 0, 12));

        jTextFieldCadastroEmail.setFont(new java.awt.Font("Arial", 0, 12));

        jTextFieldCadastroTel.setFont(new java.awt.Font("Arial", 0, 12));

        jTextFieldCadastroLimite.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N

        jLabelCadastro1.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelCadastro1.setText("CNPJ:");

        jLabelCadastro2.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelCadastro2.setText("Insc. Estad.");

        jLabelCadastro3.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelCadastro3.setText("Abertura:");

        jLabelCadastro4.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelCadastro4.setText("Colaboradores:");

        jTextFieldCadastro4.setFont(new java.awt.Font("Arial", 0, 12));

        jTextFieldCadastro3.setFont(new java.awt.Font("Arial", 0, 12));

        jTextFieldCadastro2.setFont(new java.awt.Font("Arial", 0, 12));

        jTextFieldCadastro1.setFont(new java.awt.Font("Arial", 0, 12));

        jLabelEndUF.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabelEndUF.setText("UF:");

        jLabelEndCidade.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelEndCidade.setText("Cidade:");

        jLabelEndBairro.setFont(new java.awt.Font("Arial", 0, 12));
        jLabelEndBairro.setText("Bairro:");

        jLabelEndRua.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabelEndRua.setText("Rua:");

        jLabelEndNum.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabelEndNum.setText("Número:");

        jLabelEndCEP.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        jLabelEndCEP.setText("CEP:");

        jButtonConfirmar.setText("Confirmar");
        jButtonConfirmar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConfirmarActionPerformed(evt);
            }
        });

        jButtonLimpar.setText("Limpar");
        jButtonLimpar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLimparActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelCadastrosNomeLayout = new javax.swing.GroupLayout(jPanelCadastrosNome);
        jPanelCadastrosNome.setLayout(jPanelCadastrosNomeLayout);
        jPanelCadastrosNomeLayout.setHorizontalGroup(
            jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCadastrosNomeLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelCadastrosNomeLayout.createSequentialGroup()
                        .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelCadastroLimite)
                            .addComponent(jLabelCadastroNome)
                            .addComponent(jLabelCadastroEmail)
                            .addComponent(jLabelCadastroTel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelCadastrosNomeLayout.createSequentialGroup()
                                .addGap(1, 1, 1)
                                .addComponent(jTextFieldCadastroEmail, javax.swing.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE))
                            .addComponent(jTextFieldCadastroTel, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
                            .addComponent(jTextFieldCadastroNome, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldCadastroLimite, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
                            .addGroup(jPanelCadastrosNomeLayout.createSequentialGroup()
                                .addComponent(jRadioButtonJuridica)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jRadioButtonFisica)
                                    .addComponent(jTextFieldCadastro1, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
                                    .addComponent(jTextFieldCadastro2, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
                                    .addComponent(jTextFieldCadastro3, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
                                    .addComponent(jTextFieldCadastro4, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)))))
                    .addComponent(jLabelCadastro1)
                    .addComponent(jLabelCadastro2)
                    .addComponent(jLabelCadastro3)
                    .addComponent(jLabelCadastro4))
                .addGap(18, 18, 18)
                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelEndUF)
                    .addComponent(jLabelEndCidade)
                    .addComponent(jLabelEndBairro)
                    .addComponent(jLabelEndRua)
                    .addComponent(jLabelEndNum)
                    .addComponent(jLabelEndCEP))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jTextFieldEndUF, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTextFieldEndCidade, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                        .addComponent(jTextFieldEndBairro)
                        .addComponent(jTextFieldEndRua)
                        .addComponent(jTextFieldEndNum, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTextFieldEndCEP))
                    .addGroup(jPanelCadastrosNomeLayout.createSequentialGroup()
                        .addComponent(jButtonConfirmar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonLimpar, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanelCadastrosNomeLayout.setVerticalGroup(
            jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelCadastrosNomeLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanelCadastrosNomeLayout.createSequentialGroup()
                        .addComponent(jTextFieldEndUF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldEndCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldEndBairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldEndRua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldEndNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jTextFieldEndCEP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelCadastrosNomeLayout.createSequentialGroup()
                        .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jTextFieldCadastroNome)
                                .addComponent(jLabelEndUF))
                            .addComponent(jLabelCadastroNome))
                        .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelCadastrosNomeLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldCadastroEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabelCadastroEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabelEndCidade))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldCadastroTel)
                                    .addComponent(jLabelCadastroTel)
                                    .addComponent(jLabelEndBairro))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTextFieldCadastroLimite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabelEndRua)))
                            .addComponent(jLabelCadastroLimite, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jRadioButtonFisica)
                            .addComponent(jRadioButtonJuridica)
                            .addComponent(jLabelEndNum))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelCadastro1)
                            .addComponent(jTextFieldCadastro1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabelEndCEP))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelCadastro2)
                    .addComponent(jTextFieldCadastro2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelCadastro3)
                    .addComponent(jTextFieldCadastro3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelCadastrosNomeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelCadastro4)
                    .addComponent(jTextFieldCadastro4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonConfirmar)
                    .addComponent(jButtonLimpar))
                .addContainerGap())
        );

        jPanel1.add(jPanelCadastrosNome, "cardCadastros");
        jRadioButtonJuridica.doClick();
        jRadioButtonJuridicaActionPerformed(null);

        jMenuArquivo.setLabel("Arquivo");

        jMenuItemCadastros.setText("Cadastros");
        jMenuItemCadastros.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemCadastrosActionPerformed(evt);
            }
        });
        jMenuArquivo.add(jMenuItemCadastros);

        jMenuItemConsultas.setText("Consultas");
        jMenuItemConsultas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemConsultasActionPerformed(evt);
            }
        });
        jMenuArquivo.add(jMenuItemConsultas);

        jMenuItemArquivoSair.setLabel("Sair");
        jMenuItemArquivoSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemArquivoSairActionPerformed(evt);
            }
        });
        jMenuArquivo.add(jMenuItemArquivoSair);

        jMenuBar1.add(jMenuArquivo);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 594, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItemArquivoSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemArquivoSairActionPerformed
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItemArquivoSairActionPerformed

    private void jTextFieldSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldSearchActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jTextFieldSearchActionPerformed

    private void jTextFieldSearchKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldSearchKeyTyped
        // TODO add your handling code here:
        List<Pessoa> pl = PessoaManager.searchByMatch(jTextFieldSearch.getText()+evt.getKeyChar());
        DefaultListModel myListModel = (DefaultListModel) jListConsulta.getModel();
        
        myListModel.setSize(0);
        
        for (int i = 0;i < pl.size(); i++) {
            myListModel.addElement(pl.get(i).getNome());
        }
    }//GEN-LAST:event_jTextFieldSearchKeyTyped

    private void jListConsultaValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListConsultaValueChanged
        if (jListConsulta.getSelectedIndex() == -1) {
            resetInfoFields();
            return;
        }
        PessoaJuridica pj = PessoaJuridicaManager.searchByName(jListConsulta.getSelectedValue().toString());
        if (pj != null) {
            jTextAreaInfo.setText(pj.getDadosPessoaJuridica());
            jTextAreaEnd.setText(pj.getEnd().toString());
        } else {
            PessoaFisica pf = PessoaFisicaManager.searchByName(jListConsulta.getSelectedValue().toString());
            jTextAreaInfo.setText(pf.getDadosPessoaFisica());
            jTextAreaEnd.setText(pf.getEnd().toString());
            jTextAreaInfo.setText(jTextAreaInfo.getText());
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_jListConsultaValueChanged

    private void jRadioButtonFisicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonFisicaActionPerformed
        // TODO add your handling code here:
        showCadastroGroup("Fisica");
    }//GEN-LAST:event_jRadioButtonFisicaActionPerformed

    private void jRadioButtonJuridicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonJuridicaActionPerformed
        showCadastroGroup("Juridica");
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonJuridicaActionPerformed

    private void jMenuItemConsultasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemConsultasActionPerformed
        CardLayout cl = (CardLayout) jPanel1.getLayout();
        cl.show(jPanel1, "cardConsultas");
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItemConsultasActionPerformed

    private void jMenuItemCadastrosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCadastrosActionPerformed
        CardLayout cl = (CardLayout) jPanel1.getLayout();
        cl.show(jPanel1, "cardCadastros");
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItemCadastrosActionPerformed

    private void jButtonLimparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLimparActionPerformed

        jTextFieldCadastro1.setText("");         jTextFieldCadastro2.setText("");         jTextFieldCadastro3.setText("");         jTextFieldCadastro4.setText("");          jTextFieldCadastroEmail.setText("");         jTextFieldCadastroLimite.setText("");         jTextFieldCadastroNome.setText("");         jTextFieldCadastroTel.setText("");          jTextFieldEndBairro.setText("");         jTextFieldEndCEP.setText("");         jTextFieldEndCidade.setText("");         jTextFieldEndNum.setText("");         jTextFieldEndRua.setText("");         jTextFieldEndUF.setText("");          // TODO add your handling code here:}//GEN-LAST:event_jButtonLimparActionPerformed
    }
        private void jButtonConfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConfirmarActionPerformed
            Cidade cidade;
            Endereco end;
            if ((jTextFieldEndCidade.getText().length() < 2) || (jTextFieldEndUF.getText().length() < 2)) {
                JOptionPane.showConfirmDialog(this, "Informe Cidade e  UF (estado)");
                return;
            } else {
               cidade = new Cidade();
               cidade.setNome(jTextFieldEndCidade.getText());
               cidade.setUf(jTextFieldEndUF.getText());
            }
            if ((jTextFieldEndRua.getText().length() < 2) || (jTextFieldEndBairro.getText().length() < 2)) {
                JOptionPane.showConfirmDialog(this, "Informe Rua e Bairro");
                return;
            } else {
                end = new Endereco();
                end.setCidade(cidade);
                end.setRua(jTextFieldEndRua.getText());
                end.setBairro(jTextFieldEndBairro.getText());
                end.setCep(jTextFieldEndCEP.getText());
                end.setNum(Integer.parseInt(jTextFieldEndNum.getText()));
            }
            if (jTextFieldCadastroNome.getText().length() < 2) {
                JOptionPane.showMessageDialog(this, "Informe nome");
                return;
            } else 
            if ((PessoaFisicaManager.searchByName(jTextFieldCadastroNome.getText()) != null) ||
                (PessoaJuridicaManager.searchByName(jTextFieldCadastroNome.getText())!= null)) {
                JOptionPane.showMessageDialog(this, "Este nome já está registrado");
                return;
            }
            if (Float.valueOf(jTextFieldCadastroLimite.getText()) >= 0) {
                JOptionPane.showMessageDialog(this, "Limite deve ser negativo");
                return;
            }
            if (jRadioButtonJuridica.isSelected()) {
                if (jTextFieldCadastro1.getText().length() < 3) {
                    JOptionPane.showMessageDialog(this, "Informe CNPJ");
                    return;
                }
                PessoaJuridica pj = new PessoaJuridica();
                pj.setAnoAbert(Integer.parseInt(jTextFieldCadastro3.getText()));
                pj.setCnpj(jTextFieldCadastro1.getText());
                pj.setEmail(jTextFieldCadastroEmail.getText() );
                pj.setEnd(end);
                pj.setInscEstad(jTextFieldCadastro2.getText() );
                pj.setNome(jTextFieldCadastroNome.getText());
                pj.setNumColab(Integer.parseInt(jTextFieldCadastro4.getText()));
                pj.setTel(jTextFieldCadastroTel.getText());
                pj.setValEmp(0);
                pj.setValMaxEmp(Long.valueOf(jTextFieldCadastroLimite.getText()) );
                
                Session session = HibernateUtil.getSessionFactory().getCurrentSession();
                session.beginTransaction();
                CidadeDAO.save(session, cidade);
                EnderecoDAO.save(session, end);
                PessoaJuridicaDAO.save(session, pj);
                session.getTransaction().commit();
                PessoaManager.startSearchEngine();
                JOptionPane.showMessageDialog(this, "Cadastro realizado com sucesso");
                
            } else {
                if ((jTextFieldCadastro1.getText().length() < 4) || (jTextFieldCadastro2.getText().length() < 4)) {
                    JOptionPane.showConfirmDialog(this, "Informe RG e CPF");
                    return;
                }
                PessoaFisica pf = new PessoaFisica();
                pf.setAlt(Integer.parseInt(jTextFieldCadastro3.getText()));
                pf.setCpf(jTextFieldCadastro2.getText());
                pf.setEmail(jTextFieldCadastroEmail.getText());
                pf.setEnd(end);
                pf.setNome(jTextFieldCadastroNome.getText());
                pf.setPeso(Integer.parseInt(jTextFieldCadastro4.getText()));
                pf.setRg(jTextFieldCadastro1.getText());
                pf.setTel(jTextFieldCadastroTel.getText());
                pf.setValMaxEmp(Long.valueOf(jTextFieldCadastroLimite.getText()));
                pf.setValEmp(0);
                
                Session session = HibernateUtil.getSessionFactory().getCurrentSession();
                session.beginTransaction();
                CidadeDAO.save(session, cidade);
                EnderecoDAO.save(session, end);
                PessoaFisicaDAO.save(session, pf);
                
                session.getTransaction().commit();
                PessoaManager.startSearchEngine();
                JOptionPane.showMessageDialog(this, "Cadastro realizado com sucesso");
            }
            
            // TODO add your handling code here:
    }//GEN-LAST:event_jButtonConfirmarActionPerformed

    private void jButtonOpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOpActionPerformed
        if (jListConsulta.getSelectedIndex() < 0) {
            JOptionPane.showMessageDialog(this, "Selecione um usuário");
            return;
        }
        System.out.println(jListConsulta.getSelectedValue().toString());
        new JDialogOperacao(this, true,jListConsulta.getSelectedValue().toString()).setVisible(true);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonOpActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new JFramePrincipal().setVisible(true);
            }
        });
    }
    
    private DefaultListModel listModel = new DefaultListModel();
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonConfirmar;
    private javax.swing.JButton jButtonLimpar;
    private javax.swing.JButton jButtonOp;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabelCadastro1;
    private javax.swing.JLabel jLabelCadastro2;
    private javax.swing.JLabel jLabelCadastro3;
    private javax.swing.JLabel jLabelCadastro4;
    private javax.swing.JLabel jLabelCadastroEmail;
    private javax.swing.JLabel jLabelCadastroLimite;
    private javax.swing.JLabel jLabelCadastroNome;
    private javax.swing.JLabel jLabelCadastroTel;
    private javax.swing.JLabel jLabelEndBairro;
    private javax.swing.JLabel jLabelEndCEP;
    private javax.swing.JLabel jLabelEndCidade;
    private javax.swing.JLabel jLabelEndNum;
    private javax.swing.JLabel jLabelEndRua;
    private javax.swing.JLabel jLabelEndUF;
    private javax.swing.JLabel jLabelInfo1;
    private javax.swing.JLabel jLabelInfo2;
    private javax.swing.JLabel jLabelInfo3;
    private javax.swing.JLabel jLabelInfo4;
    private javax.swing.JLabel jLabelInfo5;
    private javax.swing.JLabel jLabelInfoEmail;
    private javax.swing.JLabel jLabelInfoMaxValue;
    private javax.swing.JLabel jLabelInfoNome;
    private javax.swing.JLabel jLabelInfoTel;
    private javax.swing.JLabel jLabelInfoValue;
    private javax.swing.JList jListConsulta;
    private javax.swing.JMenu jMenuArquivo;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItemArquivoSair;
    private javax.swing.JMenuItem jMenuItemCadastros;
    private javax.swing.JMenuItem jMenuItemConsultas;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanelCadastrosNome;
    private javax.swing.JPanel jPanelConsultas;
    private javax.swing.JPanel jPanelInfoGeral;
    private javax.swing.JRadioButton jRadioButtonFisica;
    private javax.swing.JRadioButton jRadioButtonJuridica;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextArea jTextAreaEnd;
    private javax.swing.JTextArea jTextAreaInfo;
    private javax.swing.JTextField jTextFieldCadastro1;
    private javax.swing.JTextField jTextFieldCadastro2;
    private javax.swing.JTextField jTextFieldCadastro3;
    private javax.swing.JTextField jTextFieldCadastro4;
    private javax.swing.JTextField jTextFieldCadastroEmail;
    private javax.swing.JTextField jTextFieldCadastroLimite;
    private javax.swing.JTextField jTextFieldCadastroNome;
    private javax.swing.JTextField jTextFieldCadastroTel;
    private javax.swing.JTextField jTextFieldEndBairro;
    private javax.swing.JTextField jTextFieldEndCEP;
    private javax.swing.JTextField jTextFieldEndCidade;
    private javax.swing.JTextField jTextFieldEndNum;
    private javax.swing.JTextField jTextFieldEndRua;
    private javax.swing.JTextField jTextFieldEndUF;
    private javax.swing.JTextField jTextFieldSearch;
    // End of variables declaration//GEN-END:variables

    private void resetInfoFields() {
        jLabelInfoNome.setText("Nome:");
        jLabelInfoEmail.setText("Email:");
        jLabelInfoTel.setText("Tel:");
        jLabelInfoValue.setText("Saldo:");
        jLabelInfoMaxValue.setText("Limite:");
        
        
        jLabelInfo1.setText("");
        jLabelInfo2.setText("");
        jLabelInfo3.setText("");
        jLabelInfo4.setText("");
        jLabelInfo5.setText("");
    }
    
    
    private void showCadastroGroup(String card) {
        if (card.equals("Fisica")) {
            jLabelCadastro1.setText("RG:");
            jLabelCadastro2.setText("CPF:");
            jLabelCadastro3.setText("Altura:");
            jLabelCadastro4.setText("Peso:");
        } else 
        if (card.equals("Juridica")) {
            jLabelCadastro1.setText("CNPJ:");
            jLabelCadastro2.setText("Insc. Estad.:");
            jLabelCadastro3.setText("Abertura:");
            jLabelCadastro4.setText("Colaboradores:");            
        } else {
            jLabelCadastro1.setText("");
            jLabelCadastro2.setText("");
            jLabelCadastro3.setText("");
            jLabelCadastro4.setText("");              
        }
            
    }
    
}
